<?php

/**
 * Страница мультиязычная 
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class Type17Form extends BaseMaterialForm
{
  public function configure()
  {
  	
  			unset( 
  		$this['created_at'],  
  		$this['updated_at'],  
  		$this['user_id'], 
  		$this['click'], 
  		$this['country'],
  		$this['custom_int3'],
  		$this['custom_text1'],
  		$this['custom_text2'],
  		$this['custom_text3'],
  		$this['custom_char2'],
  		$this['custom_char3'],
  		$this['seo_title'],
  		$this['seo_keyword'],
  		$this['stat'],
  		$this['parent_id'],
  		$this['link']);
  		
   		$c = new Criteria ( );	
		$c->addAnd ( FolderPeer::TREE_PARENT, 1, Criteria::NOT_EQUAL );
		$c->addAnd ( MaterialPeer::ID, 'tt' ); 		
  		
  		$this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(array(),array('size'=>'60')),
      'type_id'           => new sfWidgetFormInputHidden(array(), array('value' =>'10', 'class'=>'test')),	
  	 
  	 
    ));

   
    
    /*
     *'content' => new sfWidgetFormTextareaTinyMCE(array(),array('class'=>'material_content','width'=>'600px')),
     *  
     */
  	
  		

		$this->validatorSchema ['photo_path'] = new sfValidatorFile ( array ('required' => false, 
		'path' => sfConfig::get ( 'sf_web_dir' ) . '/uploads/material/news', 
		'mime_types' => 'web_images', 'max_size' => 500000, // 360 kB
        'validated_file_class' => 'sfMatNewsValidatedFile'
         ) );
        
  	    
           
       
        $this->validatorSchema->setOption('allow_extra_fields', true);    
  		 
  		 $this->widgetSchema->setNameFormat('material[%s]');	 

  		  foreach (sfContext::getInstance()->getUser()->getLangs() as $culture)
       {
       	     
          		 $if = new Type17I18nForm($this->getObject()->getCurrentMaterialI18n($culture));
  		         $this->embedForm($culture,$if);
       }
    //    $this->embedI18n(sfContext::getInstance()->getUser()->getLangs());
            
    //$myDecorator = new myListFormDecorator($this->getWidgetSchema());
    //$this->widgetSchema->addFormFormatter('custom', $myDecorator);
    //$this->widgetSchema->setFormFormatterName('custom');
       

       $this->widgetSchema->setFormFormatterName('list');
       
            
  
  }
}
  
  
  
  
	
 
  



class myListFormDecorator extends sfWidgetFormSchemaFormatter {
  protected
    $rowFormat = "
      %hidden_fields% %field% %help%
    ",
    $helpFormat = '<div class="help">%help%</div>',
    $errorRowFormat = "%error%",
    $errorListFormatInARow = "\n",
    $errorRowFormatInARow = "\n",
    $namedErrorRowFormatInARow = "\n",
    $decoratorFormat = "%content%";
}
